<?php
if($_POST['sub']!=''){
   $data=array(
            'cardno'=>trim($_POST['cardno']),
            "utime"=>time(),
    );

    if(trim($_POST['cardno'])==""){
        jumpajax('300','卡号不能为空','');
    }
    if(strlen($_POST['cardno'])!=7){
        jumpajax('300','卡号长度为7','');
    }
    $pattern='/^\d{7}$/';
    preg_match($pattern, $_POST['cardno'], $match);
    if(empty($match)){
       jumpajax('300','卡号格式为纯数字',''); 
    }
    if($ezhand->check_cardno($_POST['cardno'])>0){
        jumpajax('300','卡号“'.$data["cardno"].'”已存在','');
    }
    $id=$ezhand->insert("cardlist",$data);
    if($id>0)
    jumpajax('200','保存成功','','closeCurrent');
}
?>